package com.wei.frame.utils;

import androidx.annotation.Nullable;

/**
 * 作者:赵若位
 * 时间:2020/8/20 10:46
 * 功能:
 */
public final class Preconditions {
    public static <T> T checkNotNull(T value, @Nullable Object errorMessge) {
        if (value == null) {
            throw new NullPointerException(String.valueOf(errorMessge));
        } else {
            return value;
        }
    }

    public static <T> T checkNotNull(T value, @Nullable String errorMessageTemplate, @Nullable Object... errorMessage) {
        if (value == null) {
            throw new NullPointerException(String.format(errorMessageTemplate, errorMessage));
        } else {
            return value;
        }
    }

    private Preconditions() {
        throw new AssertionError("No instances.");
    }
}
